package com.jeesite.modules.dataScreen.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 指标数据类型
 *
 * @author machenzhi
 * since 2023/12/5 11:49
 * @version 1.0
 */
@Getter
@AllArgsConstructor
public enum DataTypeEnum {

    REAL_TIME("1", "实时数据"),

    UNREAL_TIME("2", "非实时数据"),

    TIANBAO("3", "填报数据"),
   ;

    private final String code;

    private final String text;


    public static DataTypeEnum getEnum(String code) {
        return Arrays.stream(DataTypeEnum.values()).filter(x -> Objects.equals(x.getCode(), code)).findFirst().orElse(null);
    }

    public static String getText(String code) {
        DataTypeEnum e = getEnum(code);
        return Objects.nonNull(e) ? e.getText() : null;
    }
}
